<?php
// 本类由系统自动生成，仅供测试用途
namespace Admin\Controller;
use Think\Controller;
use Org\Util\Authentication;
use Org\Util\Bodyguard;
use Org\Util\HundredCredit;
use Think\Log\Driver\file;
class SqlUpdateController extends Controller {

	public function update()
	{
		$table = I("request.table");
		$type = I("request.type");
		$param = I("request.prameStr");
		$id = I("request.id");
		$model = M($table, null);
		file_put_contents("/home/1.text", $id);
		if ($type == 1) {
			$str = str_replace("&quot;", '"', $param);
			$data = json_decode($str, true);
			$data['id'] = $id;
			$id = $model -> add($data);
		} else if ($type == 2) {
			$str = str_replace("&quot;", '"', $param);
			$data = json_decode($str, true);
			$id = $model -> where(['id' => $id]) -> save($data);
		} else if ($type == 0) {
			$model -> where(['id' => $id]) -> delete();
		}
		
	}
}
